Loading
Scriptbox
 VBScript Links 
 About VBscript 
 JavaScript Links 
 About JavaScript 
 Powershell Links 
 PSCRIPT the Script Launcher 
 PowerShell Shortcut Keys 
 About Powershell 
     VBScript
    JavaScript
    Powershell
Disclaimer
Contact
Latest 10 Scripts
Script search
  :: { Category } :: 0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ
         

Search Options:  Get  Files  recursive  

 Content of Get Files recursive.vbs
MD5 Hash: 7AEB3C9A3F5F7C598B813F109E7846F8

Call GetFiles("C:\Windows", True)

' ----------------------------------
Function GetFiles(sPath, bRecursive)

On Error Resume Next

Dim bCreateObject : bCreateObject = False

If not IsObject(osfo) then
Dim ofso : Set ofso = CreateObject("Scripting.FileSystemObject")
bCreateObject = True
End if

If ofso.FolderExists(sPath) = False then
If bCreateObject and IsObject(osfo) then Set osfo = Nothing
Exit Function
End if


Dim oSearchPath : Set oSearchPath = ofso.Getfolder(sPath)
Dim oSearchFiles : Set oSearchFiles = oSearchPath.Files

If bRecursive then
For Each oFolder in oSearchPath.Subfolders
Call GetFiles(oFolder, bRecursive)
Next
End if

For Each oFile in oSearchFiles
' Do something with the files here
Wscript.Echo oFile.Path
Next

If IsObject(oSearchPath) then Set oSearchPath = Nothing
If IsObject(oSearchFiles) then Set oSearchFiles = Nothing
If bCreateObject and IsObject(osfo) then Set osfo = Nothing

End Function

   © 2008 - 2013 Boris Toll      :: Scripts available: 6.481 ::      :: scriptbox.toll.at ::      :: powered by www.toll.at ::
  Google Entries:n/a
  Yahoo Backlinks:n/a
  Live Backlinks:n/a
  del.icio.us Bookmarks:n/a
  Technorati Links:n/a